package com.zhouyu;

import com.zhouyu.service.A;
import com.zhouyu.service.B;
import org.springframework.core.OrderComparator;
import org.springframework.core.Ordered;

import java.util.ArrayList;
import java.util.List;

/**
 * @author leimingchao
 * create 2025-05-02 21:14
 */
public class Main {

	public static void main(String[] args) {

		A a = new A();

		B b = new B();

		OrderComparator comparator = new OrderComparator();
		System.out.println(comparator.compare(a, b));

		List<Ordered> list = new ArrayList<>();
		list.add(a);
		list.add(b);

		//按order值升序排列
		list.sort(comparator);

		System.out.println(list);
	}
}
